<template>
	<view>
		<view v-if="orderList.length==0" style="color: #CCCCCC;text-align: center;width: 100%;height: 500upx;line-height: 500upx;font-size: 32upx;"> 暂无数据</view>
		<view v-else v-for="(item,index) in orderList" :key="index" class="un-recharge">
			<view class="un-recharge1">
				<text class="un-recharge1-text">时间：</text>
				<text>{{item.STARTDATE}}</text>
				<text class="un-recharge1-text1" >-{{item.AMOUNT}}</text>
			</view>
			<view class="un-recharge2">
				<view>流水号：{{item.ORDERNUM}}</view>
				<view class="un-recharge2-text" v-if="item.OUTSTARTE==2" >手续费：             {{item.OTHERMONEY}} 元</view>
				<view class="un-recharge2-text" >余额：             {{item.NOWAMOUNT}} 元</view>
				<view class="un-recharge2-text" v-if="item.OUTSTARTE==2" >转账单号：             {{item.PAYNUM}} 元</view>
				<view class="un-recharge2-text" v-if="item.OUTSTARTE==1" >审核状态：             待审核</view>
				<view class="un-recharge2-text" v-if="item.OUTSTARTE==2" >审核状态：             通过</view>
				<view class="un-recharge2-text" v-if="item.OUTSTARTE==3" >审核状态：             驳回</view>
				<view class="un-recharge2-text" v-if="item.OUTSTARTE==3" >驳回原因：             {{item.DESCRIBE}} 元</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				recordList:[
					{id:1,time:'2017-05-21 16:00',cardNo:'55646464844654',money:50,balance:80},
					{id:1,time:'2017-05-21 16:00',cardNo:'55646464844654',money:50,balance:80},
				],
				orderList:[],
				isOut : 0
			}
		},
		onLoad(option){
			if(option.isOut == 1){
				//提现
				this.isOut = 1
				uni.setNavigationBarTitle({
				    title:'提现记录'
				})
			} else {
				//交易
				this.isOut = 2
				uni.setNavigationBarTitle({
				    title:'交易记录'
				})
			}
			this.loadData()
			uni.startPullDownRefresh();
		},
		onPullDownRefresh() {
			console.log('refresh');
			setTimeout(function () {
				uni.stopPullDownRefresh();
			}, 1000);
		},
		methods: {
			async loadData(){
				this.$http.post('/user/queryMoneyIn1',{
					SIGNATURE : uni.getStorageSync("SIGNATURE"),
					TOKEN: uni.getStorageSync("userInfo").TOKEN,
					TYPE:2
				}).then((res1)=>{
					
					if(res1.data.STATE == '903'||res1.data.STATE == '904'){
						uni.navigateTo({
							url:'/pages/public/login1'
						})
					}
					//判断返回内容
					if(res1.data.STATE === "0" && res1.statusCode === 200){
						console.log("66666662222",res1)
						this.orderList = res1.data.OBJECT
						console.log("66666662222",this.orderList)
						// var orderList = res1.data.OBJECT.sort((a,b)=>b.WATERID-a.WATERID)
						// var orderList1 = orderList.map(item=>{
						// 	var h = item.FTIME.substring(0,2)
						// 	console.log(">>>>>>>>>>>",h)
						// 	var m = item.FTIME.substring(2,4)
						// 	var s = item.FTIME.substring(4,6)
						// 	item.FTIME = h +':'+ m +':'+ s 
						// 	item.FDATE =  item.FDATE+" "+item.FTIME
						// 	return item
						// })
						// ;
						// this.orderList = orderList1.sort((a,b)=>{
						// 	return new Date(Date.parse(b.FDATE.replace(/-/g,"/")))-new Date(Date.parse(a.FDATE.replace(/-/g,"/")))
						// })
					}
				})
				.catch((err1)=>{
					console.log('request fail', err1);
				})
			},
		}
	}
</script>

<style lang="scss">
	page{
		background-color: #F5F5F5;
		padding: 20upx 30upx;
		/* #ifdef MP-WEIXIN */
		width: 92%;
		/* #endif */
	}
	.un-recharge{
		height: 260upx;
		border-radius: 10upx;
		background-color: #FFFFFF;
		margin-bottom: 20upx;
		padding: 20upx 30upx;
		.un-recharge1{
			color: #666666;
			font-size: 28upx;
			line-height: 80upx;
			.un-recharge1-text{
				color: #999999;
				font-size: 25upx;
			}
			.un-recharge1-text1{
				float: right;
				color: #F04844;
			}
		}
		.un-recharge2{
			color: #999999;
			font-size: 25upx;
			line-height: 40upx;
			.un-recharge2-text{
				// float: left;
				margin-top: 10upx;
			}
		}
	}
</style>
